package cn.hejiang.mamis.core.service.impl;

import java.util.List;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.hejiang.mamis.core.entity.SysPage;
import cn.hejiang.mamis.core.mapper.SysPageMapper;
import cn.hejiang.mamis.core.service.SysPageService;

@Service
@CacheConfig(keyGenerator = "cacheKeyGenerator")
public class SysPageServiceImpl extends ServiceImpl<SysPageMapper, SysPage> implements SysPageService {
	@Cacheable("SYS_PAGE")
	public SysPage getPageById(String pageId, String sysId) {
		return this.getBaseMapper().getPageById(pageId, sysId);
	}

	@Cacheable("SYS_PAGE")
	public List<SysPage> getPageList(String orderBy, String orderDir, String sysId) {
		return this.getBaseMapper().getPageList(orderBy, orderDir, sysId);
	}

	@CacheEvict(cacheNames = "SYS_PAGE", allEntries = true)
	public boolean save(SysPage entity) {
		return super.save(entity);
	}

	@CacheEvict(cacheNames = "SYS_PAGE", allEntries = true)
	public boolean update(SysPage entity, Wrapper<SysPage> updateWrapper) {
		return super.update(entity, updateWrapper);
	}
}
